# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gtkmm3
pkgname=(
  gtkmm3
  gtkmm3-docs
)
pkgver=3.24.8
pkgrel=1
pkgdesc="C++ bindings for GTK+ 3"
url="https://www.gtkmm.org/"
arch=(loong64 x86_64)
license=(LGPL)
depends=(
  atkmm
  gtk3
  pangomm
)
makedepends=(
  atkmm-docs
  cairomm-docs
  git
  glibmm-docs
  meson
  mm-common
  pangomm-docs
)
checkdepends=(xorg-server-xvfb)
options=(!emptydirs)
_commit=07b4229ef6f91c5b8619085a37aeb190b44ea676  # tags/3.24.8^0
source=("git+https://gitlab.gnome.org/GNOME/gtkmm.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd gtkmm
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gtkmm
}

build() {
  local meson_options=(
    -D maintainer-mode=true
  )

  arch-meson gtkmm build "${meson_options[@]}"
  meson compile -C build
}

check() {
  xvfb-run -s '-nolisten local' meson test -C build --print-errorlogs
}

package_gtkmm3() {
  depends+=(
    libatkmm-1.6.so
    libcairomm-1.0.so
    libglibmm-2.4.so
    libpangomm-1.4.so
    libsigc-2.0.so
  )
  provides=(libgtkmm-3.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_gtkmm3-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}

# vim:set sw=2 sts=-1 et:
